import 'package:backend.core/core/domain/entities/web/web_money_amount.dart';
import 'package:backend.core/core/domain/entities/web/web_one_time_purchased_item_transaction.dart';
import 'package:backend.core/core/domain/entities/web/web_one_time_purchased_item_transaction_offer_type.dart';
import 'package:backend.core/core/domain/entities/web/yookassa/yookassa_transaction.dart';
import 'package:backend.core/core/domain/entities/web/yookassa/yookassa_transaction_revocation_info.dart';

class YookassaOneTimePurchasedItemTransaction extends YookassaTransaction
    implements WebOneTimePurchasedItemTransaction {
  const YookassaOneTimePurchasedItemTransaction({
    required this.id,
    required this.userId,
    required this.purchaseItemSku,
    required this.paymentMethodId,
    required this.time,
    required this.amount,
    required this.offerType,
    required this.yookassaPaymentId,
    required this.revocationInfo,
    required this.incomeAmount,
    required this.test,
  });

  @override
  final String id;

  @override
  final String userId;

  @override
  final String purchaseItemSku;

  @override
  final String paymentMethodId;

  @override
  final DateTime time;

  @override
  final WebMoneyAmount amount;

  @override
  final WebOneTimePurchasedItemTransactionOfferType offerType;

  @override
  final bool test;

  @override
  final String yookassaPaymentId;

  @override
  final WebMoneyAmount incomeAmount;

  @override
  final YookassaTransactionRevocationInfo? revocationInfo;

  @override
  List<Object?> get props {
    return [
      id,
      userId,
      purchaseItemSku,
      paymentMethodId,
      amount,
      offerType,
      time,
      yookassaPaymentId,
      revocationInfo,
      test,
      incomeAmount,
    ];
  }

  @override
  YookassaOneTimePurchasedItemTransaction copyWith({
    String Function()? id,
    String Function()? userId,
    String Function()? purchaseItemSku,
    String Function()? paymentMethodId,
    DateTime Function()? time,
    WebMoneyAmount Function()? amount,
    WebOneTimePurchasedItemTransactionOfferType Function()? offerType,
    YookassaTransactionRevocationInfo? Function()? revocationInfo,
    bool Function()? test,
    String Function()? yookassaPaymentId,
    WebMoneyAmount Function()? incomeAmount,
  }) {
    return YookassaOneTimePurchasedItemTransaction(
      id: id == null ? this.id : id(),
      userId: userId == null ? this.userId : userId(),
      purchaseItemSku: purchaseItemSku == null ? this.purchaseItemSku : purchaseItemSku(),
      paymentMethodId: paymentMethodId == null ? this.paymentMethodId : paymentMethodId(),
      time: time == null ? this.time : time(),
      amount: amount == null ? this.amount : amount(),
      offerType: offerType == null ? this.offerType : offerType(),
      revocationInfo: revocationInfo == null ? this.revocationInfo : revocationInfo(),
      test: test == null ? this.test : test(),
      yookassaPaymentId: yookassaPaymentId == null ? this.yookassaPaymentId : yookassaPaymentId(),
      incomeAmount: incomeAmount == null ? this.incomeAmount : incomeAmount(),
    );
  }
}
